package com.ouc.dataMange.service.impl;

import com.ouc.common.core.text.Convert;
import com.ouc.dataMange.domain.Upload;
import com.ouc.dataMange.mapper.CopernicusMapper;
import com.ouc.dataMange.service.CopernicusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文件管理Service业务层处理
 *
 * @author b504
 * @date 2022-09-19
 */
@Service
public class CopernicusServiceImpl implements CopernicusService {
  @Autowired
  private CopernicusMapper copernicusMapper;

  /**
   * 查询文件管理
   *
   * @param fileId 文件管理主键
   * @return 文件管理
   */
  @Override
  public Upload selectUploadByFileId(Integer fileId) {
    return copernicusMapper.selectUploadByFileId(fileId);
  }

  /**
   * 查询文件管理列表
   *
   * @param upload 文件管理
   * @return 文件管理
   */
  @Override
  public List<Upload> selectUploadList(Upload upload) {
    return copernicusMapper.selectUploadList(upload);
  }

  /**
   * 查询所有
   *
   * @return
   */
  @Override
  public List<Upload> selectAllList() {
    return copernicusMapper.selectAllList();
  }

  /**
   * 查询最新插入的
   *
   * @param upload 查询条件
   * @return
   */
  @Override
  public Upload selectNewInsert(Upload upload) {
    return copernicusMapper.selectNewInsert(upload);
  }

  @Override
  public List<Upload> selectFactorList(Upload upload) {
    return copernicusMapper.selectFactorList(upload);
  }

  /**
   * 新增文件管理
   *
   * @param upload 文件管理
   * @return 结果
   */
  @Override
  public int insertUpload(Upload upload) {
    return copernicusMapper.insertUpload(upload);
  }

  /**
   * 修改文件管理
   *
   * @param upload 文件管理
   * @return 结果
   */
  @Override
  public int updateUpload(Upload upload) {
    return copernicusMapper.updateUpload(upload);
  }

  /**
   * 批量删除文件管理
   *
   * @param fileIds 需要删除的文件管理主键
   * @return 结果
   */
  @Override
  public int deleteUploadByFileIds(String fileIds) {
    return copernicusMapper.deleteUploadByFileIds(Convert.toStrArray(fileIds));
  }

  public int deleteUploadByFileIds(Integer[] fileIds) {
    return copernicusMapper.deleteUploadByFileIds(fileIds);
  }

  /**
   * 删除文件管理信息
   *
   * @param fileId 文件管理主键
   * @return 结果
   */
  @Override
  public int deleteUploadByFileId(Integer fileId) {
    return copernicusMapper.deleteUploadByFileId(fileId);
  }
}
